﻿using Avalonia.Controls;
using Avalonia.Threading;
using LS.Screening.AvaloniaApp.ViewModels;
using LS.Screening.UI.Common.Mvvm;
using System.Threading.Tasks;

namespace LS.Screening.AvaloniaApp.Views;

public partial class MainWindow : AbstractWindow<MainWindowViewModel>
{
    public MainWindow()
    {
        InitializeComponent();
        this.Loaded += MainWindow_Loaded;
    }

    private void MainWindow_Loaded(object sender, Avalonia.Interactivity.RoutedEventArgs e)
    {
        Task.Run(async () =>
        {
            await Task.Delay(5000);
            await Dispatcher.UIThread.InvokeAsync(() =>
             {
                 var panel = this.FindControl<StackPanel>("ContentArea");
                 panel.Children.Clear();
                 panel.Children.Add(new AboutView());
             });
        });
    }
}
